package com.sxt.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@NoArgsConstructor
@AllArgsConstructor
@Data
public class MyResult implements Serializable {

      //成功或者失败的状态标识  例如成功 status=1  失败status=0
      private   int status;
      //响应回去的提示信息
      private  String  msg;
      //响应回去的数据
      private  Object  data;


       public   static MyResult  ok(){
            MyResult  myResult=new MyResult();
            myResult.setStatus(1);
            myResult.setMsg("成功");
            return  myResult;
       }
        public   static MyResult  ok(Object data){
            MyResult  myResult=new MyResult();
            myResult.setStatus(1);
            myResult.setMsg("成功");
            myResult.setData(data);
            return  myResult;
        }

    public   static MyResult  error(String  msg){
        MyResult  myResult=new MyResult();
        myResult.setStatus(0);
        myResult.setMsg(msg);
        return  myResult;
    }

}
